package com.wechat.utils.kit;

/**
 * Created by Administrator on 2016/11/16.
 */
public class TempleteMsg {

    /**
                                                【订单支付结果通知】
     {{first.DATA}}
     订单号：{{keyword1.DATA}}
     支付金额：{{keyword2.DATA}}
     支付时间：{{keyword3.DATA}}
     支付状态：{{keyword4.DATA}}
     商品信息：{{keyword5.DATA}}
     {{remark.DATA}}

     * @param openid
     * @param url
     * @param title
     * @param orderNo
     * @param price
     * @param name
     * @param date
     * @param remark
     * @return
     */
    public static String paySuccessMsg(String openid, String url, String title, String orderNo, String price, String name, String date, String remark) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("{");
        buffer.append("\"touser\":\"" + openid + "\",");
        buffer.append("\"template_id\":\"FgjbpMcaqbO_t7ZVwjAK9hjyPWgbg5gW0Cxa2gdJtM8\",");
        buffer.append("\"url\":\"" + url + "\",");
        buffer.append("\"data\":{");
        buffer.append("\"first\": {\"value\":\"" + title + "\"},");
        buffer.append(" \"keyword1\":{\"value\":\"" + orderNo + "\"},");
        buffer.append(" \"keyword2\":{\"value\":\"" + price + "\"},");
        buffer.append(" \"keyword3\":{\"value\":\"" + date + "\"},");
        buffer.append(" \"keyword4\":{\"value\":\"支付成功\"},");
        buffer.append(" \"keyword5\":{\"value\":\"" + name + "\"},");
        buffer.append(" \"remark\":{\"value\":\"" + remark + "\"}");

        buffer.append("}");
        buffer.append("}");
        return buffer.toString();

    }


    /**
                                            【退款申请成功通知模板】
     {{first.DATA}}
     商品名称：{{keyword1.DATA}}
     金额：{{keyword2.DATA}}
     退款情况：{{keyword3.DATA}}
     {{remark.DATA}}

     * @param openid
     * @param url
     * @param title
     * @param name
     * @param price
     * @param remark
     * @return
     */
    public static String refundOrderMsg(String openid, String url,String title,String name,String price,String remark){
        StringBuffer buffer = new StringBuffer();
        buffer.append("{");
        buffer.append("\"touser\":\"" + openid + "\",");
        buffer.append("\"template_id\":\"RFMgzxSrsVpFtbwnKB_T4b5QyQgVJq3P_NG_yqhVsrs\",");
        buffer.append("\"url\":\"" + url + "\",");
        buffer.append("\"data\":{");

        buffer.append("\"first\": {\"value\":\"" + title + "\"},");
        buffer.append(" \"keyword1\":{\"value\":\"" + name + "\"},");
        buffer.append(" \"keyword2\":{\"value\":\"" + price + "\"},");
        buffer.append(" \"keyword3\":{\"value\":\"等待打款\"},");
        buffer.append(" \"remark\":{\"value\":\"" + remark + "\"}");
        buffer.append("}");
        buffer.append("}");
        return buffer.toString();
    }


    /**
                                                    【优惠券限时下单成功通知】
     {{first.DATA}}
     订单编号：{{keyword1.DATA}}
     商品名称：{{keyword2.DATA}}
     商品数量：{{keyword3.DATA}}
     订单总额：{{keyword4.DATA}}
     {{remark.DATA}}

     * @param openid
     * @param url 详情页面url
     * @param title 通知的标题
     * @param orderNo 订单号
     * @param name 商品名称
     * @param price 商品总价
     * @param counts  购买数量
     * @param remark 备注
     * @return
     */
    public static String orderSuccessMsg(String openid, String url,String title,String orderNo,String name,String price,int counts,String remark){
        StringBuffer buffer = new StringBuffer();
        buffer.append("{");
        buffer.append("\"touser\":\"" + openid + "\",");
        buffer.append("\"template_id\":\"kk8T1eWFQKTRJslv0YY6C1PU4v2s-xHcuDyRR8ZoRFs\",");
        buffer.append("\"url\":\"" + url + "\",");
        buffer.append("\"data\":{");

        buffer.append("\"first\": {\"value\":\"" + title + "\"},");
        buffer.append(" \"keyword1\":{\"value\":\"" + orderNo + "\"},");
        buffer.append(" \"keyword2\":{\"value\":\"" + name + "\"},");
        buffer.append(" \"keyword3\":{\"value\":\"" + counts + "\"},");
        buffer.append(" \"keyword4\":{\"value\":\""+price+"\"},");
        buffer.append(" \"remark\":{\"value\":\"" + remark + "\"}");
        buffer.append("}");
        buffer.append("}");
        return buffer.toString();
    }

    /**
                                                    【核券成功通知】
     {{first.DATA}}
     卡券编号：{{keyword1.DATA}}
     卡券类型：{{keyword2.DATA}}
     卡券内容：{{keyword3.DATA}}
     {{remark.DATA}}

     * @param openid
     * @param url
     * @param title
     * @param couponNo
     * @param type
     * @param name
     * @param remark
     * @return
     */
    public static String verifyCouponSuccessMsg(String openid,String url,String title,String couponNo,String type,String name,String remark){
        StringBuffer buffer = new StringBuffer();
        buffer.append("{");
        buffer.append("\"touser\":\"" + openid + "\",");
        buffer.append("\"template_id\":\"tDGVqVIbKzVF5SFxzrK97RcyjFsJ8IuLkwVfmGWkFVI\",");
        buffer.append("\"url\":\"" + url + "\",");
        buffer.append("\"data\":{");

        buffer.append("\"first\": {\"value\":\"" + title + "\"},");
        buffer.append(" \"keyword1\":{\"value\":\"" + couponNo + "\"},");
        buffer.append(" \"keyword2\":{\"value\":\"" + type + "\"},");
        buffer.append(" \"keyword3\":{\"value\":\"" + name + "\"},");
        buffer.append(" \"remark\":{\"value\":\"" + remark + "\"}");
        buffer.append("}");
        buffer.append("}");
        return buffer.toString();
    }
}
